import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:umeng_push_demo/routes.dart';
import 'package:umeng_push_demo/view/home_page.dart';
import 'package:get/get.dart';

/// FileName app
///
/// @Author 陈晓星
/// @Date 2024/10/25 08:32
///
/// @Description TODO

class App extends StatelessWidget {
  const App({super.key});

  @override
  Widget build(BuildContext context) {
    return ScreenUtilInit(
      designSize: const Size(375, 812),
      builder: (context, child) {
        return GetMaterialApp(
          title: '消息推送',
          theme: ThemeData(
            colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
            useMaterial3: true,
          ),
          getPages: AppRoutes.allGetPages,
          navigatorObservers: [AppRoutes.routeObserver],
          builder: (context, widget) {
            Widget child = MediaQuery(
              //设置文字大小不随系统设置改变
              data: MediaQuery.of(context).copyWith(textScaler: const TextScaler.linear(1.0)),
              child: widget ?? Container(),
            );
            return child;
          },
        );
      },
    );
  }
}